package binderipc

import android.os.IBinder
import android.os.IInterface
import android.os.ParcelFileDescriptor
import android.os.RemoteException
import kotlin.jvm.Throws

interface IPassValue : IInterface {

    @Throws(RemoteException::class)
    fun passInt(value: Int) : Int

    @Throws(RemoteException::class)
    fun passString(str: String)

    @Throws(RemoteException::class)
    fun updateValue(strValue: String)

    @Throws(RemoteException::class)
    fun transactFileDescriptor(pfd: ParcelFileDescriptor? = null)

    @Throws(RemoteException::class)
    fun getPFD(): ParcelFileDescriptor?

    @Throws(RemoteException::class)
    fun passValueByOneWay(value0: Int, value1: Int) : Int

    companion object {
        const val descriptor = "android.binderipc.IPassValue"

        const val PASS_INT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION
        const val PASS_STRING_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 1
        const val PASS_VALUE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 2
        const val TRANSACT_FILE_DESCRIPTOR_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 3
        const val GET_PFD_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 4
        const val PASS_VALUE_BY_ONEWAY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 5
    }
}